const express = require('express')

const app = express()

//定义中间件函数
const mw1 = (req, res, next) => {
  console.log('调用了局部生效的中间件')
  next()
  
}

//创建路由
app.get('/', (req, res) => {
  res.send('Home page.')
})

app.get('/user', mw1, (req, res) => {
  res.send('User page.')
})


app.listen(80, () => {
  console.log('http://127.0.0.1')
  
})